'''
@Author: your name
@Date: 2020-06-05 13:55:23
@LastEditTime: 2020-06-24 09:10:59
@LastEditors: Please set LastEditors
@Description: In User Settings Edit
@FilePath: /mtl-text-recognition/config/concat_dict.py
'''
# -*- encoding: utf-8 -*-
# author:lmolhw
# datetime:2020-5-7 13:30

"""
文件说明：
    合并dict
"""


def open_txt(file_name):
    with open(file_name, 'r') as f:
        try:
            line = f.readline()
            while line:
                yield line.strip()
                line = f.readline()
        except:
            print('No value')


dict1 = [x.strip() for x in open_txt('/data1/lhw/workspace/demo/OCR/YYZZ/addr_dict.txt')]
dict2 = [x.strip() for x in open_txt('/data1/lhw/workspace/mtl-text-recognition/config/dict/cleaned_all_dict.txt')]
new_dict = open('/data1/lhw/workspace/mtl-text-recognition/config/dict/cleaned_addr_all_dict.txt', 'w')
for c in dict2:
    if c not in dict1:
        dict1.append(c.strip())
for j in dict1:
    new_dict.writelines(j.strip() + '\n')
